home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / kriegspi / output.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-30  |  2.0 KB  |  85 lines

  1. #ifndef lint
  2. static char rcsid[] = "$Header: output.c,v 1.1 87/02/12 11:07:18 schoch Exp $";
  3. #endif
  4.  
  5. #include "externs.h"
  6. #include <strings.h>
  7.  
  8. redraw ()
  9. {
  10.     int i;
  11.  
  12.     if (vtterm) {
  13.         /* make characters double-width on a vt100 type terminal */
  14.         overwrite (stdscr, backupscreen);
  15.         overwrite (blankscreen, stdscr);
  16.         refresh ();
  17.         printf("\0337\033[0;0H\033#6"); /* save cursor, home,
  18.                            and widen first line */
  19.         for (i = 1; i <= LINES - 1; i++)
  20.             printf("\n\033#6");    /* wide next line */
  21.         printf("\0338");        /* restore cursor */
  22.         overwrite (backupscreen, stdscr);
  23.         refresh();
  24.     } else
  25.         wrefresh(curscr);
  26. }
  27.  
  28. reportchecks (checkdirs, kingloc)
  29.     LIST checkdirs;
  30.     int kingloc;
  31. {
  32.     LIST l, lmember ();
  33.     int quadrant, n;
  34.     char str [2] [40];
  35.  
  36.     n = 0;
  37.     quadrant = ((kingloc % 10 > 4) == (kingloc/10 < 5));
  38.     if (lmember (-9, checkdirs) || lmember (9, checkdirs))
  39.         if (quadrant == 1)
  40.             strcpy (str[n++], "long diagonal\n");
  41.         else
  42.             strcpy (str[n++], "short diagonal\n");
  43.     if (lmember (-11, checkdirs) || lmember (11, checkdirs))
  44.         if (quadrant == 0)
  45.             strcpy (str[n++], "long diagonal\n");
  46.         else
  47.             strcpy (str[n++], "short diagonal\n");
  48.     if (lmember (-10, checkdirs) || lmember (10, checkdirs))
  49.         strcpy (str[n++], "file\n");
  50.     if (lmember (-1, checkdirs) || lmember (1, checkdirs))
  51.         strcpy (str[n++], "rank\n");
  52.     l = dirlist [KNIGHT];
  53.     while (l != NIL) {
  54.         if (lmember (l->i, checkdirs))
  55.             strcpy (str[n++], "knight\n");
  56.         l = l->n;
  57.     }
  58.     if (n > 0) {
  59.         waddstr (win [CHECK], "check by the\n");
  60.         waddstr (win [CHECK], str[0]);
  61.     }
  62.     if (n == 2) {
  63.         waddstr (win [CHECK], "and ");
  64.         waddstr (win [CHECK], str[1]);
  65.     }
  66.     refresh();
  67. }
  68.  
  69. illegal (why, color)
  70.     int color, why;
  71. {
  72.     wclear (win [LEGAL]);
  73.     if (why == ILLEGAL)
  74.         waddstr (win [LEGAL], "illegal");
  75.     else if (color == ourcolor) {
  76.         if (why == NOMOREPAWNTRIES)
  77.             waddstr (win [LEGAL], "3 pawns tried");
  78.         else if (why == NOWAY)
  79.             waddstr (win [LEGAL], "no way");
  80.         else if (why == AMBIGUOUS)
  81.             waddstr (win [LEGAL], "ambiguous");
  82.     } else
  83.         waddstr (win [LEGAL], "nope");
  84. }
  85.